package com.futureCloudMOM.controller.core.web.basic;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.futureCloudMOM.common.core.page.TableDataInfo;
import com.futureCloudMOM.common.utils.core.QueryWapperDTO;
import com.futureCloudMOM.common.utils.core.QueryWapperUtils;
import com.futureCloudMOM.controller.core.controller.BaseApiController;
import com.futureCloudMOM.core.vo.BasicGroupEmpVO;
import com.futureCloudMOM.core.domain.BasicGroupEmp;
import com.futureCloudMOM.core.service.BasicGroupEmpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 文件名 BasicGroupEmpController
 *
 * @since 2023/6/6 13:55
 */
@Api(tags = "班组员工信息")
@RestController
@RequestMapping("basic/group_emp")
public class BasicGroupEmpController extends BaseApiController<BasicGroupEmp, BasicGroupEmpVO, BasicGroupEmpService> {

    public BasicGroupEmpController(BasicGroupEmpService service) {
        super(service);
    }

    @ApiOperation(value = "列表页方法重写")
    @PostMapping("/getListByVO")
    public TableDataInfo getList(BasicGroupEmpVO entity,@RequestBody(required = false) List<QueryWapperDTO> list){
        startPage();
        QueryWrapper<BasicGroupEmpVO> queryWrapper = QueryWapperUtils.wapperJojnt(entity,list);
        queryWrapper.eq("deleted",0);
        queryWrapper.orderByDesc("sysCreateTime");
        return getDataTable(service.getList(queryWrapper));
    }

}
